// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  postRequest,
  deleteRequest,
  uploadFile,
} from "@/libs/axios";

// 获取实训基地分页列表
export const postTrainBasePage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest("/trainingBase/trainingBase/pagelist", params, headers);
};

// 获取实训基地类型
export const getTrainBaseType = () => {
  return getRequest("/trainingBase/trainingBase/getTrainingBaseCategory");
};

// 获取实训基地详情
export const getTrainBaseInfo = (id) => {
  return getRequest(`/trainingBase/trainingBase/${id}`);
};

// 新增、编辑实训基地 禁-启用基地状态
export const postTrainBase = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest("/trainingBase/trainingBase/save", params, headers);
};

// 获取基地所属单位
export const getTrainBaseUnit = () => {
  return getRequest("/permission/department");
};

// 上传基地封面
export const postUpload = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest(uploadFile, params, headers);
};

// 删除实训基地
export const delTrainBase = (params) => {
  return postRequest('/trainingBase/trainingBase/delete', params);
};

// 新增基地类型
export const postTrainBaseType = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest("/trainingBase/trainingBase/addTrainingBaseCategory", params, headers);
};

// 删除基地类型
export const delTrainBaseType = (id) => {
  return deleteRequest(`/trainingBase/trainingBase/deleteTrainingBaseCategory/${id}`);
};

// 获取预约记录列表
export const postTrainBaseOrderList = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest('/trainingBase/trainingBase/trainingOrderRecords', params, headers);
};

// 强制释放
export const postTrainBaseCancel = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest('/trainingBase/trainingBase/forceCancel', params, headers);
};